﻿using HKB.Web;
using HKB.Web.Admin;
using System;
using System.Web.Profile;
using System.Web.SessionState;
using System.Web.UI.WebControls;

public partial class Admin_Admin_ProductAttributes : Admin, IRequiresSessionState
{
    protected DefaultProfile profile
    {
        get
        {
            return (DefaultProfile)this.Context.Profile;
        }
    }
    protected global_asax applicationInstance
    {
        get
        {
            return (global_asax)this.Context.ApplicationInstance;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!base.IsPostBack)
        {
            this.AttributesTypeBind();
        }
    }
    protected void AttributesTypeBind()
    {
        Shop_ProductAttributes shop_ProductAttributes = new Shop_ProductAttributes();
        this.GridView_Type.DataSource = shop_ProductAttributes.GetAllAttributesTypeAndCount("");
        this.GridView_Type.DataBind();
    }
    protected void GridView_Type_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        Shop_ProductAttributes shop_ProductAttributes = new Shop_ProductAttributes();
        if (e.CommandName == "_Delete")
        {
            if (shop_ProductAttributes.DeleteAttributes(0, e.CommandArgument.ToString()))
            {
                this.WriteSuccessMsg("", "删除成功！", "Admin_ProductAttributes.aspx");
            }
        }
        else
        {
            base.Response.Redirect("Admin_ProductAttributesEdit.aspx?Type=" + e.CommandArgument.ToString() + "&&Model=_EditType");
        }
    }
    protected void Button_Search_Click(object sender, EventArgs e)
    {
        Shop_ProductAttributes shop_ProductAttributes = new Shop_ProductAttributes();
        this.GridView_Type.DataSource = shop_ProductAttributes.GetAllAttributesTypeAndCount(this.TextBox_Type.Text.Trim());
        this.GridView_Type.DataBind();
    }
}
